<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/7/29
  Time: 0:01
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <title>快件e栈服务平台</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <link href="css/normalize.css" type="text/css" rel="stylesheet"/>
    <link href="css/main.css" type="text/css" rel="stylesheet"/>
    <script src="js/jquery-1.11.1.js" type="text/javascript"></script>
    <script src="js/notice.js" type="text/javascript"></script>
    <script src="js/common.js" type="text/javascript"></script>
</head>
<body>
<div class="content">
    <div class="top autoH">
        <div class="logo autoH">
            <img src="images/logo.png" width="100%">
        </div>
    </div>
    <div class="middle">
        <form id="theForm">
            <div class="forminput">
                <input type="text" id="expressNum" name="expressNum" placeholder="请输入快递单号...">
                <input id="PageContext" type="hidden" value="${pageContext.request.contextPath}"/>
                <div class="submBtn" onclick="findDelivery()"></div>
            </div>
        </form>
    </div>
    <div class="funContdiv">
        <div class="funCont">
            <div class="userFun">
                <p class="funIcon userFunColor1" onclick="skipPersonalPage()"></p>
                <p class="funTxt" onclick="skipPersonalPage()">个人中心</p>
            </div>
            <div class="userFun" >
                <p class="funIcon userFunColor2" onclick="skipLazyBoardPage()"></p>
                <p class="funTxt" onclick="skipLazyBoardPage()">懒人排行</p>
            </div>
            <div class="userFun" ${(sessionScope.adminName!=null)?"hidden":""}>
                <p class="funIcon userFunColor3" onclick="skipPickExpressPage()" ></p>
                <p class="funTxt" onclick="skipPickExpressPage()">取货二维码</p>
            </div>
            <div class="userFun" ${(sessionScope.adminName!=null)?"hidden":""}>
                <p class="funIcon userFunColor4" ></p>
                <p class="funTxt">我的快件</p>
            </div>

            <div class="userFun"  ${(sessionScope.adminName==null)?"hidden":""}>
                <p class="funIcon userFunColor5" onclick="skipExpressAssistPage()"></p>
                <p class="funTxt" onclick="skipExpressAssistPage()">快递助手</p>
            </div>
            <div class="userFun">
                <p class="funIcon userFunColor6" onclick="loginOut()"></p>
                <p class="funTxt" onclick="loginOut()">退出登录</p>
            </div>
        </div>
    </div>

    <div class="footer">
        <p class="copytxt">&copy;新职课版权所有</p>
    </div>
</div>
<script src="js/jquery-1.11.1.js"></script>
<script src="layer/layer.js"></script>
<script src="assets/layui.all.js"></script>
<script type="text/javascript">
    $(function () {
        var pageContextVal = $("#PageContext").val();
        $(".userFun").click(function () {
            var clickNum = $(this).index();
            switch (clickNum) {
                //个人中心
                case(0):
                    window.location.href = "wxUserhome.jsp";
                    break;
                case(1):
                    window.location.href = "lazyboard.jsp";
                    break;
                case(2):
                    window.location.href = "personQRcode.jsp";
                    break;
                case(3):
                    window.location.href = "expressList.jsp";
                    break;
                case(4):
                    window.location.href = "expressAssist.jsp";
                    break;
                case(5):
                    // window.location.href = "login.html";
                    break;
            }
        });

        var initFunc = function () {
            var windowH = $(document).height();
            var windowW = $(document).width();

            $(".content").css({"height": windowH + "px"});

            var contentW = $(".content").width();
            var contentH = $(".content").height();

            var contH = windowH / 3;
            $(".autoH").css({"height": contH + "px"});

            // userFunH  content
            var middleH = $(".middle").height() + 40;
            var userFunH = contentH - contH - middleH - 30 - 20; //footer,userfun(margin)
            $(".funContdiv").css({"height": userFunH + "px"});

            var funIconH = $(".funIcon").width();
            $(".funIcon").css({
                "height": funIconH + "px",
                "line-height": funIconH + "px",
                "border-radius": funIconH / 2 + "px",
                "font-size": funIconH / 2 + "px"
            });

        };

        initFunc();

        $(window).resize(function () {
            initFunc();
        });

        // input focus
        $(".middle .forminput input").focus(function () {
            $(".middle .forminput").css({
                "border": "1px solid rgba(31,114,255,.75)",
                "box-shadow": "0 0 8px rgba(31,114,255,.5)"
            });
        });

        // input blur
        $(".middle .forminput input").blur(function () {
            $(".middle .forminput").css({"border": "1px solid #333333", "box-shadow": "none"});
        });

        //submit arrow
        // $(".submBtn").click(function () {
        //     var expressNum = $("#expressNum").val();//快递单号
        //     $.ajax({
        //         type: 'GET',
        //         url: pageContextVal + '/ul/indexQueryExpress',
        //         data: {'expressNum': expressNum},
        //         dataType: "json",
        //         success: function (data) {
        //             var jsontmp = data;
        //             switch (jsontmp.code) {
        //                 case "1" :
        //                     rzAlert("操作提示", jsontmp.message);
        //                     break;
        //                 case "0" :
        //                     rzAlert("操作提示", jsontmp.message);
        //                     break;
        //             }
        //         },
        //         error: function () {
        //
        //         }
        //     });
        // });
    });
</script>
<script>
    function findDelivery() {
        var deliveryNum = $("input:eq(0)").val();
        $.post("/wx/users/showDeliveryCode.do", {
            deliveryNum:deliveryNum
        },function (data) {
            console.log(data);
            if (data["msgCode"] == 200) {
                layer.alert("快递单号："+data["dataList"][0]["deliveryNum"]+"\n" +
                    "       取件码：    "+data["dataList"][0]["deliveryCode"]+"\n" +
                    "       快递状态：    "+data["dataList"][0]["deliveryState"]+"\n" +
                    "       收件人：    "+data["dataList"][0]["deliveryAcceptor"]+"\n" +
                    "       收件人电话：    "+data["dataList"][0]["acceptorPhone"]+"\n" +
                    "       记录时间：    "+data["dataList"][0]["stateChangeTime"]+"");
                return;
            }else{
                layer.alert("未查询到指定快递！");
            }
        },"json");
    }

    function skipPersonalPage() {
        location.href = "/wxUserhome.jsp";
    }

    function skipLazyBoardPage() {
        location.href = "/lazyboard.jsp";
    }

    function skipPickExpressPage() {
        location.href = "/pickExpress.jsp";
    }

    function skipExpressAssistPage() {
        location.href = "/expressAssist.jsp";
    }

    function loginOut() {
        var flag = true;
        $.post("/wx/couriers/loginOut.do",{},function (data) {
            console.log(data["msgCode"]);
            if (data["msgCode"] == 200) {
                console.log("logout");
                // layer.alert("退出成功！");
                location.href="/login.html";
            }else {
                flag = false;
                // layer.alert("退出失败！");
            }
        },"json");
        $.post("/wx/users/loginOut.do",{},function (data) {
            console.log(data["msgCode"]);
            if (data["msgCode"] == 200) {
                console.log("logout");
                // layer.alert("退出成功！");
                location.href="/login.html";
            }else {
                flag = false;
                // layer.alert("退出失败！");
            }
        },"json");

        if (!flag){
            layer.alert("退出失败！");
        }
    }
</script>
</body>
</html>
